<div class="container">
    <h1 id="pkg-overview">package des</h1>
    <p><code>import "crypto/des"</code>
    </p><p>des包实现了DES标准和TDEA算法，参见U.S. Federal Information Processing Standards Publication 46-3。</p>
    
    
		
        
        
        
        
        
    
    <h2 id="pkg-constants">Constants </h2>
    <pre>const <span id="BlockSize">BlockSize</span> = 8</pre>
    <p>DES字节块的大小。</p>
    <h2 id="KeySizeError">type <a href="https://github.com/golang/go/blob/master/src/crypto/des/cipher.go?name=release#15" title="View Source">KeySizeError</a> </h2>
    <pre>type KeySizeError <a href="builtin.htm#int">int</a></pre>
    <h3 id="KeySizeError.Error">func (KeySizeError) <a href="https://github.com/golang/go/blob/master/src/crypto/des/cipher.go?name=release#17" title="View Source">Error</a> </h3>
    <pre class="funcdecl">func (k <a href="#KeySizeError">KeySizeError</a>) Error() <a href="builtin.htm#string">string</a></pre>
    <h2 id="NewCipher">func <a href="https://github.com/golang/go/blob/master/src/crypto/des/cipher.go?name=release#27" title="View Source">NewCipher</a> </h2>
    <pre class="funcdecl">func NewCipher(key []<a href="builtin.htm#byte">byte</a>) (<a href="crypto/cipher.htm">cipher</a>.<a href="crypto/cipher.htm#Block">Block</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>创建并返回一个使用DES算法的cipher.Block接口。</p>
    <h2 id="NewTripleDESCipher">func <a href="https://github.com/golang/go/blob/master/src/crypto/des/cipher.go?name=release#49" title="View Source">NewTripleDESCipher</a> </h2>
    <pre class="funcdecl">func NewTripleDESCipher(key []<a href="builtin.htm#byte">byte</a>) (<a href="crypto/cipher.htm">cipher</a>.<a href="crypto/cipher.htm#Block">Block</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>创建并返回一个使用TDEA算法的cipher.Block接口。</p>
    <div class="panel-group">
        <div class="panel panel-default" id="example-NewTripleDESCipher">
            <div class="panel-heading" onclick="document.getElementById('ex-NewTripleDESCipher').style.display = document.getElementById('ex-NewTripleDESCipher').style.display=='none'?'block':'none';">Example</div>
            <div class="panel-collapse collapse" id="ex-NewTripleDESCipher">
                <div class="panel-body">
                    <pre><span class="com">// NewTripleDESCipher can also be used when EDE2 is required by</span>
<span class="com">// duplicating the first 8 bytes of the 16-byte key.</span>
ede2Key := []byte("example key 1234")
var tripleDESKey []byte
tripleDESKey = append(tripleDESKey, ede2Key[:16]...)
tripleDESKey = append(tripleDESKey, ede2Key[:8]...)
_, err := des.NewTripleDESCipher(tripleDESKey)
if err != nil {
    panic(err)
}
<span class="com">// See crypto/cipher for how to use a cipher.Block for encryption and</span>
<span class="com">// decryption.</span>
</pre>
                </div>
            </div>
        </div>
    </div>
</div>